home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Jumpstart / Multimedia Microsoft Jumpstart Version 1.1a (Microsoft).BIN / develpmt / source / blt / dva.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-26  |  4.0 KB  |  151 lines

  1. /****************************************************************************
  2.  
  3.  DVA.H
  4.  
  5.  Copyright (c) 1993 Microsoft Corporation
  6.  
  7.  DVA 1.0 Interface Definitions
  8.  
  9.  ***************************************************************************/
  10.  
  11. #ifndef _INC_DVA
  12. #define _INC_DVA
  13.  
  14. #ifdef __cplusplus
  15.     #define __inline inline
  16.     extern "C" {
  17. #endif
  18.  
  19. /****************************************************************************
  20.  ***************************************************************************/
  21.  
  22. #include "dvaddi.h"     // interface to the display driver
  23.  
  24. /****************************************************************************
  25.  ***************************************************************************/
  26.  
  27. typedef DVASURFACEINFO FAR *PDVA;
  28. typedef PDVA HDVA;
  29.  
  30. /****************************************************************************
  31.  ***************************************************************************/
  32.  
  33. //
  34. // this code in biCompression means the frame buffer must be accesed via
  35. // 48 bit pointers! using *ONLY* the given selector
  36. //
  37. // BI_1632 has bitmasks (just like BI_BITFIELDS) for biBitCount == 16,24,32
  38. //
  39. #ifndef BI_1632
  40. #define BI_1632  0x32333631     // '1632'
  41. #endif
  42.  
  43. #ifndef BI_BITFIELDS
  44. #define BI_BITFIELDS 3
  45. #endif
  46.  
  47. /****************************************************************************
  48.  ***************************************************************************/
  49.  
  50. #if TRUE || defined(_INC_VFW) || defined(_INC_DRAWDIB)
  51.  
  52. //
  53. //  this API is in MSVIDEO.DLL
  54. //
  55. extern BOOL WINAPI DVAGetSurface(HDC hdc, int nSurface, DVASURFACEINFO FAR *lpSurfaceInfo);
  56.  
  57. #else
  58.  
  59. //
  60. //  this API uses the Escape to the display driver only
  61. //
  62. __inline BOOL DVAGetSurface(HDC hdc, int nSurface, DVASURFACEINFO FAR *pdva)
  63. {
  64.     int i;
  65.  
  66.     i = Escape(hdc, DVAGETSURFACE,sizeof(int),(LPCSTR)&nSurface,(LPVOID)pdva);
  67.  
  68.     return i > 0;
  69. }
  70.  
  71. #endif
  72.  
  73. /****************************************************************************
  74.  ***************************************************************************/
  75.  
  76. __inline PDVA DVAOpenSurface(HDC hdc, int nSurface)
  77. {
  78.     PDVA pdva;
  79.  
  80.     pdva = (PDVA)GlobalLock(GlobalAlloc(GHND|GMEM_SHARE, sizeof(DVASURFACEINFO)));
  81.  
  82.     if (pdva == NULL)
  83.         return NULL;
  84.  
  85.     if (!DVAGetSurface(hdc, nSurface, pdva) ||
  86.         !pdva->OpenSurface(pdva->lpSurface))
  87.     {
  88.         GlobalFree((HGLOBAL)SELECTOROF(pdva));
  89.         return NULL;
  90.     }
  91.  
  92.     return pdva;
  93. }
  94.  
  95. /****************************************************************************
  96.  ***************************************************************************/
  97.  
  98. __inline void DVACloseSurface(PDVA pdva)
  99. {
  100.     if (pdva == NULL)
  101.         return;
  102.  
  103.     pdva->CloseSurface(pdva->lpSurface);
  104.  
  105.     GlobalFree((HGLOBAL)SELECTOROF(pdva));
  106. }
  107.  
  108. /****************************************************************************
  109.  ***************************************************************************/
  110.  
  111. __inline BOOL DVABeginAccess(PDVA pdva, int x, int y, int dx, int dy)
  112. {
  113.     return pdva->BeginAccess(pdva->lpSurface, x, y, dx, dy);
  114. }
  115.  
  116. /****************************************************************************
  117.  ***************************************************************************/
  118.  
  119. __inline void DVAEndAccess(PDVA pdva)
  120. {
  121.     pdva->EndAccess(pdva->lpSurface);
  122. }
  123.  
  124. /****************************************************************************
  125.  ***************************************************************************/
  126.  
  127. __inline LPBITMAPINFOHEADER DVAGetSurfaceFmt(PDVA pdva)
  128. {
  129.     if (pdva == NULL)
  130.         return NULL;
  131.  
  132.     return &pdva->BitmapInfo;
  133. }
  134.  
  135. /****************************************************************************
  136.  ***************************************************************************/
  137.  
  138. __inline LPVOID DVAGetSurfacePtr(PDVA pdva)
  139. {
  140.     if (pdva == NULL)
  141.         return NULL;
  142.  
  143.     return (LPVOID)MAKELONG(pdva->offSurface, pdva->selSurface);
  144. }
  145.  
  146. #ifdef __cplusplus
  147.     }
  148. #endif
  149.  
  150. #endif // _INC_DVA
  151.